package com.ucpaas.paas.web.config;


import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.concurrent.ConcurrentTaskScheduler;

/**
 * @author taoj
 * 定时任务配置
 * 在application中配置定时任务时配置
 * * TODO 给之后动态配置定时任务时提供配置信息
 */
@Configuration
@ConfigurationProperties(prefix = SchedulerConfig.PREFIX)
public class SchedulerConfig {
    public static final String PREFIX = "scheduler";

    @Bean
    public TaskScheduler taskScheduler() {

        //double threaded by default
//        return Executors.newScheduledThreadPool(2);
        //single threaded by default
        return new ConcurrentTaskScheduler();


    }
}
